package service

import (
	"os"

	"gitee.com/Luna-CY/Golang-Project-Template/internal/context"
	"gitee.com/Luna-CY/Golang-Project-Template/internal/errors"
	"gitee.com/Luna-CY/Golang-Project-Template/internal/interface/dao"
	"gitee.com/Luna-CY/Golang-Project-Template/model"
)

type SystemSmtp interface {
	Transactional

	// LogTimeTo 记录定时发送邮件
	LogTimeTo(ctx context.Context, to []string, subject string, bodyType model.SystemSmtpLogBodyType, body string, attachments []*model.SystemObject, sendTime int64, fields ...SystemSmtpLogField) errors.Error

	// SendTimeTo 发送定时发送邮件
	// attachments 附件需要从外部传入
	SendTimeTo(ctx context.Context, log *model.SystemSmtpLog, attachments []*os.File) errors.Error

	// ListSmtpLogByCondition 根据条件查询邮件日志
	ListSmtpLogByCondition(ctx context.Context, page int, size int, options ...dao.SystemSmtpLogOption) (int64, []*model.SystemSmtpLog, errors.Error)

	// BatchGetSmtpLogAttachment 批量获取邮件日志附件
	BatchGetSmtpLogAttachment(ctx context.Context, log *model.SystemSmtpLog) ([]*model.SystemSmtpLogAttachment, errors.Error)

	// Cancel 取消定时发送的邮件
	Cancel(ctx context.Context, log *model.SystemSmtpLog) errors.Error

	// UpdateLog 更新邮件日志
	UpdateLog(ctx context.Context, log *model.SystemSmtpLog, fields ...SystemSmtpLogField) errors.Error
}
